package top.zsc.cloud.demo.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import top.zsc.cloud.demo.system.po.Dept;
import top.zsc.cloud.demo.system.service.DeptClientService;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "系统管理服务接口")
@RestController
@RequestMapping("deptFeign")
public class DeptConsumerController {
    @Resource
    private DeptClientService deptClientService;

    @ApiOperation("新增部门")
    @PostMapping("insert")
    public int insert(Dept dept) {
        return deptClientService.insert(dept);
    }

    @ApiOperation("修改部门")
    @PostMapping("update")
    public int update(Dept dept) {
        return deptClientService.update(dept);
    }

    @ApiOperation("查询全部部门")
    @GetMapping("selectAll")
    public List<Dept> selectAll() {
        return deptClientService.selectAll();
    }

    @ApiOperation("根据id查询部门信息")
    @GetMapping("selectByPk/{deptId}")
    public Dept selectByPk(@PathVariable("deptId") Integer deptId) {
        return deptClientService.selectByPk(deptId);
    }

    @ApiOperation("查询全部部门")
    @GetMapping("selectByDept")
    public List<Dept> selectByDept(Dept dept) {
        return deptClientService.selectByDept(dept);
    }
}
